<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	template="/resources/layout/templateInterno.xhtml"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:t="http://myfaces.apache.org/tomahawk"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:sec="http://www.springframework.org/schema/security"
    >
	<ui:define name="body">


<script>

	jQuery(document).ready(function(){
			
		jQuery("#formCadastroMembro\\:inptCep").mask("99999-999");
		jQuery("#formCadastroMembro\\:inptCpf").mask("999.999.999-99");
		jQuery("#formCadastroMembro\\:inptCelular").mask("(99) 9999-9999");
		jQuery("#formCadastroMembro\\:inptTelefoneEmpresa").mask("(99) 9999-9999");
		jQuery("#formCadastroMembro\\:inptTelefone").mask("(99) 9999-9999");
		jQuery("#formCadastroMembro\\:inptNumero").numeric();
		jQuery("#formCadastroMembro\\:inptNuFilhos").numeric();
		
		
		 });



</script>
		
		<div class="grid-11-12">
		<h:panelGroup id="exibirTitulo">
			<h:panelGroup rendered="#{membroCadastro.acaoTela != ''}">
				
					<h1>#{membroCadastro.acaoTela} MEMBRO</h1>
				
			</h:panelGroup>
			<h:panelGroup rendered="#{membroCadastro.acaoTela == ''}">
				<div class="grid-11-12">
					<h1>PESQUISAR MEMBRO</h1>
				</div>
			</h:panelGroup>
		</h:panelGroup>
		</div>
		<div class="field-clear"></div>
		<div id="form">
		<h:form style="width:100%" id="formCadastroMembro" styleClass="form">
		<h:panelGroup style="padding: 10px" id="pgMensagens">
			  <div >
					<h:messages  layout="table" errorClass="errorMessage" infoClass="infoMessage" />
			</div>
		</h:panelGroup>
		<div  class="field-clear"></div>
		<h:panelGroup id="pgPesquisaMembro" rendered="#{membroCadastro.exibirPesquisa}" >
			 <t:fieldset id="idfsDadosPessoais"   style="width:800px" legend="Filtros">
				<a4j:region id="filtroPesquisa">
						 <div class="grid-2-12">
						<h:outputLabel class="form-lbl"  value="Matrícula:"/>				
						<h:inputText styleClass="form-txt" maxlength="9" value="#{membroCadastro.membroPesquisa.matricula}" id="matriculaPesquisa" >
						 	<rich:jQuery selector="#matriculaPesquisa" query="numeric()" timing="onload"/>
						</h:inputText>
					 </div>	
					  <div class="grid-6-12">
						<h:outputLabel class="form-lbl"  value="Nome:"/>				
						<h:inputText styleClass="form-txt"  value="#{membroCadastro.membroPesquisa.nome}" id="nomePesquisa" />
					 </div>
					<div class="grid-4-12">
						<h:outputLabel id="lbDataNascimentoPesquisa" class="form-lbl" value="Dat. Nascimento:" />
						 <rich:calendar id="clDataNascimentoPesquisa" 
						 				firstWeekDay="0" 
						 				 locale="pt_Br"
										showWeeksBar="false"
										cellWidth="24px" cellHeight="22px" style="width:200px" 
						 				minDaysInFirstWeek="2" 
						 				value="#{membroCadastro.membroPesquisa.dtNascimento}"
										datePattern="dd/MM/yyyy" inputSize="10" inputClass="maskDate" enableManualInput="true" disabled="false">
						</rich:calendar> 
						<rich:jQuery id="mskDataNascimentoPesquisa" selector=".maskDate" timing="onload" query="mask('99/99/9999',{placeholder:' '})" />
					</div>
					<div class="field-clear"></div>
					<div class="grid-2-12">
						<h:outputLabel  id="lbStatus" class="form-lbl"  value="Status:"/>
						<h:selectOneMenu id="cbStatusPesquisa" styleClass="form-txt" value="#{membroCadastro.status}">
					 		<f:selectItem itemLabel="Todos" itemValue=""/>
					 		<f:selectItem itemLabel="Ativo" itemValue="A"/>
					 		<f:selectItem itemLabel="Inativo" itemValue="I"/>
				 		</h:selectOneMenu>
				</div>
					 <div class="field-clear"></div>
					 
				</a4j:region>
			</t:fieldset>
				<div style="padding-bottom: 20px; padding-top: 20px">
				<h:panelGroup id="pgNovoPorPerfil" rendered="#{usuarioLogado.exibirNovo}">
				 <h:panelGroup  >
						<div class="grid-2-12" style="padding-left: 8px" >
							<a4j:commandButton reRender="formCadastroMembro,exibirTitulo"  styleClass="form-button" id="cbNovoMembro" value="Novo" action="#{membroCadastro.novo}" >	</a4j:commandButton>
						</div >
					</h:panelGroup  >
				</h:panelGroup>
				<h:panelGroup  >
					 <div class="grid-2-12">
						<a4j:commandButton id="cbPesquisar"  rendered="#{membroCadastro.exibirPesquisa}" 
							 styleClass="form-button" action="#{membroCadastro.pesquisar}" 
							 reRender="pgMensagens,pgPesquisaMembro,pgResultados" value="Pesquisar" />
					</div>
				</h:panelGroup>
				</div>
				
				<div class="field-clear"></div>
			<div class="field-clear"></div>
				<div style="padding: 10px" >
				 	<rich:dataTable  
	                    width="750" border="0" id="membroPesquisaTable" 
	                    styleClass="dataTable rich-table rich-table-cell ui-widget-content ui-grid-content"
	                    rendered="#{not empty membroCadastro.listaMembros}" rows="10"
	                      var="membro" value="#{membroCadastro.listaMembros}" >
					  <f:facet  name="header">
	                    <rich:columnGroup >
	                            <rich:column style="text-align: center; width:15px"  styleClass="ui-state-default" >
	                                <strong><h:outputText value="MATRÍCULA" /></strong>
	                            </rich:column>
	                            <rich:column style="text-align: center"  styleClass="ui-state-default" >
	                                <strong><h:outputText value="NOME" /></strong>
	                            </rich:column>
	                            <rich:column style="text-align: center; width:200px"  styleClass="ui-state-default" >
	                                <strong><h:outputText value="IGREJA" /></strong>
	                            </rich:column>
	                            <rich:column style="text-align: center; width:80px"  styleClass="ui-state-default" >
	                                <strong><h:outputText value="STATUS" /></strong>
	                            </rich:column>
	                             <rich:column style="text-align: center;"  styleClass="ui-state-default" >
	                                <strong><h:outputText value="Acões" /></strong>
	                            </rich:column>
	                    	</rich:columnGroup>
	                  </f:facet>
	 				<rich:columnGroup >	
	 					<rich:column style="text-align:center" >
								<h:outputText value="#{membro.coSeqMembro}" />
						</rich:column>		
						 <rich:column style="text-align:center">
							<h:outputText value="#{membro.nome}" />
						</rich:column>
						<rich:column style="text-align:center">
							<h:outputText value="#{membro.igrejaPertence.nome}" />
						</rich:column>
						<rich:column style="text-align:center">
							<h:outputText value="#{membro.status}" />
						</rich:column>
						<rich:column style="text-align:center">
						<a4j:commandLink id="editar" ajaxSingle="true" action="#{membroCadastro.editar}" reRender="formCadastroMembro,exibirTitulo"  >
								<h:graphicImage value="/resources/imagens/ico_editar.gif" id="imEditar" styleClass="hidelink"/>
								 <f:setPropertyActionListener target="#{membroCadastro.membro}" value="#{membro}"/>  
							</a4j:commandLink>
							<h:panelGroup rendered="#{usuarioLogado.exibirExcluir}">
								<a4j:commandLink id="remover" ajaxSingle="true" 
										onclick="Richfaces.showModalPanel('modalPanelConfirmaExcluir');"
										 reRender="membroPesquisaTable"  >
									 <h:graphicImage value="/resources/imagens/ico_excluir.gif" id="gIExcluirUsers" styleClass="hidelink"/>
								   <f:setPropertyActionListener target="#{membroCadastro.membro}" value="#{membro}"/>
								</a4j:commandLink>
							</h:panelGroup>
						</rich:column>
					</rich:columnGroup>
					
				</rich:dataTable>
				<div class="grid-11-12">
					<rich:datascroller align="center" renderIfSinglePage="false" for="membroPesquisaTable" />
				</div>
			</div>
				<h:panelGroup id="pgResultados">
					<div class="grid-12-12" >
						<h:outputText styleClass="infoRegistroNaoEnc" value="#{msg['info.MGS_01']}" rendered="#{membroCadastro.registroNaoEncontrado}" />
					</div>
				</h:panelGroup>
		</h:panelGroup>
		<h:panelGroup id="pgDadosMembro">
		<t:fieldset id="fildDados" rendered="#{membroCadastro.exibirCadastro}" style="width:800px" legend="Dados">	
	 		<h:panelGroup id="pgInativo"  rendered="#{membroCadastro.membro.coSeqMembro != null}">
		 		<div class="grid-2-12" >
						 <h:outputLabel id="lbStatusCadastro" class="form-lbl"  value="Inativar?"/>
						<h:selectBooleanCheckbox  id="checkStCadastro"  styleClass="form-txt" value="#{membroCadastro.membro.inativo}" >							
						</h:selectBooleanCheckbox>				
				</div>	
			</h:panelGroup>
		  	<div class="grid-1-12">	
		  			<h:outputLabel id="lbFotoCadastro" class="form-lbl"  value="Foto"/>				
					<a4j:commandLink value="Adicionar" immediate="true" reRender="formPopupAddFoto:info" onclick="Richfaces.showModalPanel('alertaAddFoto')" >
						 <f:setPropertyActionListener target="#{fileUploadBean.fileCarregar}" value="#{membroCadastro.file}"/>
					</a4j:commandLink>
			</div>
		  	
		  		<div class="grid-3-12">
					<h:outputLabel id="lbCodigo" class="form-lbl"  value="Matrícula:"/>
					<h:inputText  id="inptCodigo" disabled="true" styleClass="form-txt" value="#{membroCadastro.membro.coSeqMembro}" />
				</div> 
		</t:fieldset>
		
		<rich:tabPanel rendered="#{membroCadastro.exibirCadastro}" style="width:800px" switchType="client">
		  <rich:tab label="DADOS PESSOAIS">
					<div class="grid-5-12">
						<em class="form-req">*</em>
						<h:outputLabel  id="lbNome" class="form-lbl"  value="Nome:"/>
						<h:inputText  id="inptNome" maxlength="100"  styleClass="form-txt" required="true" requiredMessage="Favor informar o Nome" value="#{membroCadastro.membro.nome}" />
					</div>
					
					<div class="grid-3-12">
						<em class="form-req">*</em>
						<h:outputLabel  id="lbDataNascimento" class="form-lbl"  value="Data Nasc.:"/>
						<rich:calendar  required="true" requiredMessage="Favor informar a Data de Nascimento"  id="clDtInicial" firstWeekDay="0" minDaysInFirstWeek="2"
										value="#{membroCadastro.membro.dtNascimento}" 
										datePattern="dd/MM/yyyy" 
										inputSize="10" 
										showWeeksBar="false"
										inputClass="maskDate"
										enableManualInput="true"
										cellWidth="24px" cellHeight="22px" style="width:200px" 
										disabled="false">
						</rich:calendar>	
					<rich:jQuery id="mskDates" selector=".maskDate" timing="onload" query="mask('99/99/9999',{placeholder:' '})" /> 	
													
					</div>
					<div class="grid-2-12">
						<em class="form-req">*</em>
						<h:outputLabel  id="lbSexo" class="form-lbl"  value="Sexo:"/>
						<h:selectOneMenu  required="true" requiredMessage="Favor informar o Sexo" id="cbSexo" styleClass="form-txt" value="#{membroCadastro.membro.sexo}">
					 		<f:selectItem itemLabel="Selecione ..." itemValue=""/>
					 		<f:selectItem itemLabel="Masculino" itemValue="M"/>
					 		<f:selectItem itemLabel="Feminino" itemValue="F"/>
				 		</h:selectOneMenu>
					</div>
					
						<div class="grid-2-12">
						<em class="form-req">*</em>
						<h:outputLabel  id="lbEstadoCivil" class="form-lbl"  value="Estado Civil:"/>
						<h:selectOneMenu id="cbEstadoCivil"  required="true" requiredMessage="Favor informar o Estado Civil" styleClass="form-select" value="#{membroCadastro.membro.estadoCivil}">
							<f:selectItem itemLabel="Selecione ..." itemValue=""/>
					 		<f:selectItem itemLabel="Casado(a) " itemValue="CS"/>
					 		<f:selectItem itemLabel="Separado(a) " itemValue="SP"/>
					 		<f:selectItem itemLabel="Solteiro(a) " itemValue="ST"/>
				 			<f:selectItem itemLabel="Divorciado(a) " itemValue="DV"/>
			 				<f:selectItem itemLabel="Viúvo(a) " itemValue="VU"/>
			 				<a4j:support id="sptEstadoCivil"  ajaxSingle="true" event="onchange" reRender="pgDadosCasadosDtNome" ></a4j:support>
				 		</h:selectOneMenu>
					</div>
					 <div class="grid-4-12">
						<h:outputLabel  id="lbLogradouro" class="form-lbl"  value="Logradouro:"/>
						<h:inputText  id="inptLogradouro" maxlength="100" styleClass="form-txt" value="#{membroCadastro.membro.logradouro}" />
					</div>
					<div class="grid-1-12">
						<h:outputLabel  id="lbNumero" class="form-lbl"  value="Número:"/>
						<h:inputText  id="inptNumero" maxlength="10" styleClass="form-txt" value="#{membroCadastro.membro.numero}" >
							 <rich:jQuery selector="#inptNumero" query="mask('?99999')" timing="onload"/>
						</h:inputText>
					</div>
					<div class="grid-3-12">
						<h:outputLabel  id="lbComplemento" class="form-lbl"  value="Complemento:"/>
						<h:inputText  id="inptComplemento" maxlength="100" styleClass="form-txt" value="#{membroCadastro.membro.complemento}" />
					</div>
					<div class="grid-3-12">
						<h:outputLabel  id="lbBairro" class="form-lbl"  value="Bairro:"/>
						<h:inputText  id="inptBairro" maxlength="100" styleClass="form-txt" value="#{membroCadastro.membro.bairro}" />
					</div>
					<div class="grid-2-12">
						<h:outputLabel  id="lbCep" class="form-lbl"  value="CEP"/>
						<h:inputText  id="inptCep" maxlength="25" styleClass="form-txt" value="#{membroCadastro.membro.cep}" >
							 <rich:jQuery selector="#inptCep" query="mask('99999-999')" timing="onload"/>
						</h:inputText>
					</div>
					<div class="grid-4-12">
						<h:outputLabel  id="lbCidade" class="form-lbl"  value="Cidade:"/>
						<h:inputText  id="inptCidade" maxlength="100" styleClass="form-txt" value="#{membroCadastro.membro.cidade}" />
					</div>	
						
					<div class="grid-2-12" >
						<h:outputLabel  id="lbUf" class="form-lbl"  value="UF:"/>
						<h:selectOneMenu   id="cbUf" styleClass="form-txt" value="#{membroCadastro.membro.uf}">
					 		<f:selectItem itemLabel="Selecione ..." itemValue=""/>
				 			<f:selectItems value="#{membroCadastro.listaUfs}" />
				 		</h:selectOneMenu>
					</div>
					
					 <div class="grid-2-12">
						<h:outputLabel  id="lbNascionalidade" class="form-lbl"  value="Nascionalidade:"/>
						<h:inputText  id="inptNascionalidade" maxlength="30" styleClass="form-txt" value="#{membroCadastro.membro.nascionalidade}" />					
					</div>
					<div class="field-clear"></div>
					<div class="grid-3-12">
						<h:outputLabel  id="lbNaturalidade" class="form-lbl"  value="Naturalidade:"/>
						<h:inputText  id="inptNaturalidade" maxlength="100" styleClass="form-txt" value="#{membroCadastro.membro.naturalidade}" />					
					</div>
					 
					<div class="grid-2-12">
						<h:outputLabel  id="lbUfNaturalidade" class="form-lbl"  value="UF:"/>
						<h:selectOneMenu id="cbUfNaturalidade"  styleClass="form-txt" value="#{membroCadastro.membro.ufNaturalidade}">
					 	<f:selectItem itemLabel="Selecione ..." itemValue=""/>
				 			<f:selectItems value="#{membroCadastro.listaUfs}" />
				 		</h:selectOneMenu>					
					</div>
					
					<div class="grid-2-12">
						<h:outputLabel  id="lbRg" class="form-lbl"  value="RG:"/>
						<h:inputText maxlength="15"  id="inptRg" styleClass="form-txt" value="#{membroCadastro.membro.rg}" />					
					</div>
					
					<div class="grid-2-12">
						<h:outputLabel  id="lbCpf" class="form-lbl"  value="CPF:"/>
						<h:inputText maxlength="15"  id="inptCpf" styleClass="form-txt" value="#{membroCadastro.membro.cpf}" >
							 <rich:jQuery selector="#inptCpf" query="mask('999.999.999-99')" timing="onload"/>
						</h:inputText>					
					</div>
					
					
					<div class="grid-2-12">
						<h:outputLabel  id="lbTelefone" class="form-lbl"  value="Telefone:"/>
						<h:inputText maxlength="25"  id="inptTelefone" styleClass="form-txt" value="#{membroCadastro.membro.telefone}" >
							 <rich:jQuery selector="#inptTelefone" query="mask('(99) 9999-9999')" timing="onload"/>
						</h:inputText>					
					</div>
					<div class="field-clear"></div>
					<div class="grid-2-12">
						<h:outputLabel  id="lbCelular" class="form-lbl"  value="Celular:"/>
						<h:inputText  id="inptCelular" maxlength="25" styleClass="form-txt" value="#{membroCadastro.membro.celular}" >
							 <rich:jQuery selector="#inptCelular" query="mask('(99) 9999-9999')" timing="onload"/>
						</h:inputText>					
					</div>
					<div class="grid-2-12">
						<h:outputLabel  id="lbTelefoneEmpresa" class="form-lbl"  value="Tel. Comercial:"/>
						<h:inputText maxlength="25"  id="inptTelefoneEmpresa" styleClass="form-txt" value="#{membroCadastro.membro.telefoneEmpresa}" >
							 <rich:jQuery selector="#inptTelefoneEmpresa" query="mask('(99) 9999-9999')" timing="onload"/>
						</h:inputText>					
					</div>
					 
					<div class="grid-3-12">
						<h:outputLabel  id="lbEmail" class="form-lbl"  value="Email:"/>
						<h:inputText maxlength="100" style="text-transform: lowercase;" id="inptEmail" styleClass="form-txt" value="#{membroCadastro.membro.email}" />					
					</div>
					<div class="grid-3-12" >
						<h:outputLabel  id="lbGrauInstrucao" class="form-lbl"  value="Grau de Instrução:"/>
						<h:selectOneMenu id="cbGrauInstrucao" styleClass="form-txt" value="#{membroCadastro.membro.grauDeInstrucao}">
							<f:selectItem itemLabel="Selecione ..." itemValue=""/>
					 		<f:selectItem itemLabel="1º Grau Incompleto" itemValue="PGI"/>
					 		<f:selectItem itemLabel="1º Grau Completo" itemValue="PGC"/>
					 		<f:selectItem itemLabel="2º Grau Incompleto" itemValue="SGI"/>
					 		<f:selectItem itemLabel="2º Grau Completo" itemValue="SGC"/>
					 		<f:selectItem itemLabel="Superior Incompleto" itemValue="SI"/>
					 		<f:selectItem itemLabel="Superior Completo" itemValue="SC"/>
				 		</h:selectOneMenu>
					</div>
					<div class="grid-3-12">
						<h:outputLabel  id="lbProfissao" class="form-lbl"  value="Profissão:"/>
						<h:inputText  id="inptProfissao" maxlength="100" styleClass="form-txt" value="#{membroCadastro.membro.profissao}" />					
					</div>
					<div class="grid-2-12">
						<h:outputLabel  id="lbtipoSanguineo" class="form-lbl"  value="T. Sang.:"/>
						<h:selectOneMenu id="cbttipoSanguineo" styleClass="form-txt" value="#{membroCadastro.membro.tipoSanguineo}">
									<f:selectItem itemLabel="Selecione ..." itemValue=""/>
									 <f:selectItem itemLabel="A-" itemValue="AN" /> 
									 <f:selectItem itemLabel="A+" itemValue="AP" />
									  <f:selectItem itemLabel="B-" itemValue="BN" />
									   <f:selectItem itemLabel="B+" itemValue="BP" />
									   <f:selectItem itemLabel="AB-" itemValue="ABN" />
									   <f:selectItem itemLabel="AB+" itemValue="ABP" />
									  <f:selectItem itemLabel="O-" itemValue="ON" />
									  <f:selectItem itemLabel="O+" itemValue="OP" />
								</h:selectOneMenu>					
					</div>
					
			 </rich:tab>
			 <rich:tab label="DADOS FAMILIARES">
				 <!--	Dados familiares	-->
				
				 		<div class="grid-4-12">
							<h:outputLabel  id="lbNomePai" class="form-lbl"  value="Nome do Pai:"/>
							<h:inputText  id="inptNomPai" maxlength="100" styleClass="form-txt" value="#{membroCadastro.membro.noPai}" />					
						</div>
						<div class="grid-4-12">
							<h:outputLabel  id="lbNomeMae" class="form-lbl"  value="Nome da Mãe:"/>
							<h:inputText  id="inptNomeMae" maxlength="100" styleClass="form-txt" value="#{membroCadastro.membro.noMae}" />					
						</div>
						
						<h:panelGroup id="pgDadosCasadosDtNome" >
						<h:panelGroup id="pgDadosCasamento" rendered="#{membroCadastro.membro.estadoCivil eq 'CS'}">
							<div class="grid-3-12">
								<h:outputLabel  id="lbDataCasamento" class="form-lbl"  value="Dat. Casamento:"/>
								<rich:calendar  id="clDataCasamento" firstWeekDay="0" minDaysInFirstWeek="2"
												value="#{membroCadastro.membro.dtCasamento}" 
												datePattern="dd/MM/yyyy" 
												inputSize="10" 
												inputClass="maskDate"
												enableManualInput="true" 
												showWeeksBar="false"
												disabled="false">
								</rich:calendar>
								<rich:jQuery id="mskDateCasamento" selector=".maskDate" timing="onload" query="mask('99/99/9999',{placeholder:' '})" /> 	
							</div>
							 <div class="field-clear"></div>
							<div class="grid-4-12">
								<h:outputLabel  id="lbConjuge" class="form-lbl"  value="Conjuge:"/>
								<h:inputText  id="inptConjuge" maxlength="100" styleClass="form-txt" value="#{membroCadastro.membro.noConjuge}" />					
							</div>
							<div class="grid-2-12" style="width: 70px">
								<h:outputLabel  id="lbNuFilhos" class="form-lbl"  value="Nº de Filhos:"/>
								<h:inputText  id="inptNuFilhos" maxlength="2" styleClass="form-txt" value="#{membroCadastro.membro.nuFilhos}" >
									 <rich:jQuery selector="#inptNuFilhos" query="mask('?99')" timing="onload"/>
								</h:inputText>					
							</div>
						</h:panelGroup>
						</h:panelGroup>
		</rich:tab>
		<rich:tab label="DADOS MINISTERIAIS">
		<!--	Dados Ministeriais	-->
		
			<div class="grid-3-12" >
						<em class="form-req">*</em>
						<h:outputLabel  id="lbTipoAdmissao" class="form-lbl"  value="Tipo Admissão:"/>
						<h:selectOneMenu   converter="enumConverter" label="Tipo Admissão" required="true"  id="cbTipoAdmissao" styleClass="form-txt" value="#{membroCadastro.membro.tipoAdmissao}">
							<f:selectItem itemLabel="Selecione..." itemValue=""/>
					 		<t:selectItems value="#{membroCadastro.listaTipoAdmissao}" 
												var="tpAdm" itemLabel="#{tpAdm.descricao}" itemValue="#{tpAdm}" />
					 		<a4j:support id="sptTipoAdmissao"  ajaxSingle="true" event="onchange" reRender="pgoTipoAdmissao,fieldSetconversao,fieldSetFuncoesPretendidas" ></a4j:support>
				 		</h:selectOneMenu>
					</div>
						<div class="grid-4-12">
							<em class="form-req">*</em>
							<h:outputLabel  id="lbLocalFrequencia"  class="form-lbl"  value="Local de Frequência:"/>
							<h:selectOneMenu converter="indexConverter" 
									label="Local de Frequência"	id="cbLocalFrequencia" required="true"  value="#{membroCadastro.membro.igrejaPertence}">
									 <f:selectItem itemLabel="Selecione..." itemValue=""/>
								   <t:selectItems value="#{membroCadastro.listaIgreja}" var="igreja" itemLabel="#{igreja.nome}" itemValue="#{igreja}"/>
								   <a4j:support id="sptIgrejaFrequenta"  ajaxSingle="true" event="onchange" action="#{membroCadastro.carregarFuncoes}"  reRender="pgFuncaoPrentendida,pgFuncaoExerce" ></a4j:support>
							</h:selectOneMenu>					
				</div>		
				<div class="field-clear"></div>
				
			<h:panelGroup id="pgoTipoAdmissao" style="width: 90%" >
					<h:panelGroup rendered="#{membroCadastro.membro.tipoAdmissao.codigo eq 'T'}" style="width: 90%" >
					<t:fieldset styleClass="panel" legend="Dados Tranferência:">
							<div class="grid-3-12">
								<h:outputLabel  id="lbDataAdmissaoTransf" class="form-lbl"  value="Data de Admissão:"/>
								<rich:calendar  id="clDataAdmissaoTransf" firstWeekDay="0" minDaysInFirstWeek="2" 
												value="#{membroCadastro.membro.dtAdmissao}" 
												datePattern="dd/MM/yyyy" 
												inputSize="10" 
												inputClass="maskDate"
												enableManualInput="true" 
												showWeeksBar="false"
												disabled="false">
								</rich:calendar>	
								<rich:jQuery id="mskDateAdmissaoTransf" selector=".maskDate" timing="onload" query="mask('99/99/9999',{placeholder:' '})" /> 
							</div>
						<div class="grid-3-12">
							<h:outputLabel  id="lbDtConversaoTransf" class="form-lbl"  value="Data de Conversão:"/>
							<rich:calendar  id="clDtConversaoTransf" firstWeekDay="0" minDaysInFirstWeek="2"
											value="#{membroCadastro.membro.dtConversao}" 
											datePattern="dd/MM/yyyy" 
											inputSize="10" 
											inputClass="maskDate"
											showWeeksBar="false"
											enableManualInput="true" 
											disabled="false">
							</rich:calendar>	
							<rich:jQuery id="mskDateConversaoTranf" selector=".maskDate" timing="onload" query="mask('99/99/9999',{placeholder:' '})" />
							
						</div>
						<div class="grid-3-12">
							<h:outputLabel  id="lbDataBatismoAntes" class="form-lbl"  value="Data Batismo:"/>
							<rich:calendar  id="clDataBatismoAntes" firstWeekDay="0" minDaysInFirstWeek="2" 
											value="#{membroCadastro.membro.dtBatismo}" 
											datePattern="dd/MM/yyyy" 
											inputSize="10" 
											inputClass="maskDate"
											enableManualInput="true" 
											showWeeksBar="false"
											disabled="false">
							</rich:calendar>	
							<rich:jQuery id="mskDateBatismoAntes" selector=".maskDate" timing="onload" query="mask('99/99/9999',{placeholder:' '})" /> 
						</div>
					
						<div class="grid-4-12">
							<h:outputLabel  id="lbLocalIgrejaBatAnterior" class="form-lbl" for="inptIgrejaLocalBatAnterior"  value="Local/Igreja do Batismo:"/>
							<h:inputText id="inptIgrejaLocalBatAnterior" maxlength="60" styleClass="form-txt" value="#{membroCadastro.membro.localBatismo}" />					
						</div>
						<div class="grid-4-12">
							<h:outputLabel  id="lbPrOficiante" class="form-lbl"  value="Pr. Oficiante:"/>
							<h:inputText  id="inptPrOficiante" maxlength="100" styleClass="form-txt" value="#{membroCadastro.membro.prOficiante}" />					
						</div>
						<div class="field-clear"></div>
						<div class="grid-4-12">
							<h:outputLabel  id="lbNomeIgrejaTransf" class="form-lbl"  value="Igreja de Tranferência:"/>
							<h:inputText   id="inptNomeIgrejaTransf" maxlength="100" styleClass="form-txt" value="#{membroCadastro.membro.noIgrejaTransferencia}" />					
						</div>
						
						<div class="grid-3-12">
							<h:outputLabel  id="lbFuncaoIgrejaAnterior" class="form-lbl"  value="Função Anterior:"/>
							<h:inputText  id="inptFuncaoIgrejaAnterior"  maxlength="100" styleClass="form-txt"  />					
						</div>	
						<div class="grid-2-12" >
							<h:outputLabel  id="lbEConsagradoMinistAntes" class="form-lbl"  value="É Consagrado?"/>
							<h:selectBooleanCheckbox  id="inptEConsagradoMinistAntes"  styleClass="form-txt" value="#{membroCadastro.membro.existeConsagracaoAntes}" >
								<a4j:support id="sptConsagracaoMinistAntes"  ajaxSingle="true" event="onclick" reRender="pgExisteConsagracao" >
								</a4j:support>
							</h:selectBooleanCheckbox>					
						</div>
						<h:panelGroup id="pgExisteConsagracao" >
							<h:panelGroup rendered="#{membroCadastro.membro.existeConsagracaoAntes}">
								<div class="grid-3-12">
									<h:outputLabel  id="lbConsagracaoMinistAntes" class="form-lbl"  value="Ministério:"/>
										<h:inputText label="Ministério" required="true" requiredMessage="Campo Ministério é obrigatório."  id="inptConsagracaoMinistAntes"  maxlength="100" styleClass="form-txt" value="#{membroCadastro.membro.consagracaoMinisterialAntes}" >
									</h:inputText>					
								</div>
								<div class="field-clear"></div>
								<div class="grid-3-12">
									<h:outputLabel  id="lbDtConsagracaoMinistAntes" class="form-lbl"  value="Data de Consagração:"/>
									<rich:calendar  id="clDtConsagracaoMinistAntes" firstWeekDay="0" minDaysInFirstWeek="2"
													value="#{membroCadastro.membro.dtConsMinisterialAntes}" 
													datePattern="dd/MM/yyyy" 
													inputSize="10"
													inputClass="maskDate" 
													showWeeksBar="false"
													enableManualInput="true" 
													disabled="false">
									</rich:calendar>	
									<rich:jQuery id="mskDateConsMinsterial" selector=".maskDate" timing="onload" query="mask('99/99/9999',{placeholder:' '})" /> 
								</div>
							</h:panelGroup>
						</h:panelGroup>
						
				</t:fieldset>
			</h:panelGroup>
			</h:panelGroup>
			
				 <a4j:outputPanel  id="fieldSetconversao" > 
				<t:fieldset styleClass="panel" rendered="#{membroCadastro.membro.tipoAdmissao.codigo  eq 'C'}"   legend="Dados Conversão" >
				
						<div class="grid-3-12">
								<h:outputLabel  id="lbDataAdmissao" class="form-lbl"  value="Data de Admissão:"/>
								<rich:calendar  id="clDataAdmissao" firstWeekDay="0" minDaysInFirstWeek="2" 
												value="#{membroCadastro.membro.dtAdmissao}" 
												datePattern="dd/MM/yyyy" 
												inputSize="10" 
												inputClass="maskDate"
												enableManualInput="true"
												showWeeksBar="false" 
												disabled="false">
								</rich:calendar>	
								<rich:jQuery id="mskDateAdmissao" selector=".maskDate" timing="onload" query="mask('99/99/9999',{placeholder:' '})" /> 
						</div>
						<div class="grid-3-12">
							<h:outputLabel  id="lbDtConversao" class="form-lbl"  value="Data de Conversão:"/>
							<rich:calendar  id="clDtConversao" firstWeekDay="0" minDaysInFirstWeek="2"
											value="#{membroCadastro.membro.dtConversao}" 
											datePattern="dd/MM/yyyy" 
											inputSize="10" 
											inputClass="maskDate"
											showWeeksBar="false"
											enableManualInput="true" 
											disabled="false">
							</rich:calendar>	
							<rich:jQuery id="mskDateConversao" selector=".maskDate" timing="onload" query="mask('99/99/9999',{placeholder:' '})" />
							
						</div>
						<div class="grid-3-12">
							<h:outputLabel  id="lbDtBatismo" class="form-lbl"  value="Data de Batismo:"/>
							<rich:calendar  id="clDtBatismo" firstWeekDay="0" minDaysInFirstWeek="2"
											value="#{membroCadastro.membro.dtBatismo}" 
											datePattern="dd/MM/yyyy" 
											inputSize="10" 
											inputClass="maskDate"
											enableManualInput="true" 
											showWeeksBar="false"
											disabled="false">
							</rich:calendar>
							<rich:jQuery id="mskDateBatismo" selector=".maskDate" timing="onload" query="mask('99/99/9999',{placeholder:' '})" />	
						</div>
							<div class="grid-3-12">
								<h:outputLabel  id="lbConsagracaoMinist" class="form-lbl"  value="Consagração Ministerial:"/>
								<h:selectOneMenu id="cbConsagracaoMinist" value="#{membroCadastro.membro.consagracaoMinisterial}">
									<f:selectItem itemLabel="Selecione ..." itemValue=""/>
									 <t:selectItems value="#{membroCadastro.listaTipoConsagracaoMinisterial}" 
												var="tpConsagracao" itemLabel="#{tpConsagracao.descricao}" itemValue="#{tpConsagracao}" />
								</h:selectOneMenu>					
							</div>
							<div class="field-clear"></div>
							<div class="grid-3-12">
							<h:outputLabel  id="lbDtConsagracaoMinist" class="form-lbl"  value="Data da Consagração:"/>
							<rich:calendar  id="clDtConsagracaoMinist" firstWeekDay="0" minDaysInFirstWeek="2"
											value="#{membroCadastro.membro.dtConsagracaoMinist}" 
											datePattern="dd/MM/yyyy" 
											inputSize="10" 
											inputClass="maskDate"
											enableManualInput="true" 
											showWeeksBar="false"
											disabled="false">
							</rich:calendar>	
							<rich:jQuery id="mskDateConsagracao" selector=".maskDate" timing="onload" query="mask('99/99/9999',{placeholder:' '})" />
						</div>
						
						
					</t:fieldset>
				<div class="field-clear"></div>	
				 <a4j:outputPanel  id="fieldSetFuncoesPretendidas" > 
					<t:fieldset styleClass="panel" rendered="#{membroCadastro.membro.tipoAdmissao.codigo  eq 'C' || membroCadastro.membro.tipoAdmissao.codigo  eq 'T'}"   legend="Funções" >
					
						<ui:include src="/views/cadastro/funcoesMembro.xhtml" />
						</t:fieldset>	
					</a4j:outputPanel>
					
					
						</a4j:outputPanel>
									
						<div class="grid-4-12">
								<h:outputLabel  id="lbOrigemReligiosa" class="form-lbl"  value="Origem Religiosa"/>
								<h:selectOneMenu id="cbOrigemReligiosa" value="#{membroCadastro.membro.origemReligiosa}">
								   <f:selectItem itemLabel="Selecione..." itemValue="" />
								   <f:selectItem itemLabel="Nascido em lar evangélico" itemValue="NB" />
								   <f:selectItem itemLabel="Católico" itemValue="CT" />
								   <f:selectItem itemLabel="Espírita" itemValue="ES"/>
								   <f:selectItem itemLabel="Outros" itemValue="OT"/>
								</h:selectOneMenu>					
							</div>
			</rich:tab>
			<rich:tab label="OBSERVAÇÕES">
				<div class="grid-7-12">
					<h:outputLabel id="lbDescricao" class="form-lbl" value="Observação:" />
					 <h:inputTextarea style="width: 700px; height: 150px" onkeyup="this.value = this.value.substring(0, 2000);" styleClass="form-txt" value="#{membroCadastro.membro.observacao}" >
					  <f:validateLength maximum="100"></f:validateLength>
					 </h:inputTextarea>
				</div>	
			</rich:tab>
			</rich:tabPanel>
			
		</h:panelGroup>
			<div  class="field-clear"></div>
			
			  <h:panelGroup rendered="#{membroCadastro.exibirBotaoVoltar}">
				<div class="grid-2-12" style="padding-left: 8px" >
					<a4j:commandButton  styleClass="form-button" id="cbVoltarMembro" immediate="true"  reRender="formCadastroMembro,exibirTitulo,pGPopupValidaNumeroFaixa" value="Voltar" action="#{membroCadastro.voltar}" >	
					</a4j:commandButton>
				</div >
			</h:panelGroup>
			 <h:panelGroup id="pgSalvarPorPerfil" rendered="#{usuarioLogado.exibirSalvar}">
			   <h:panelGroup rendered="#{membroCadastro.exibirBotaoSalvar}" >
					<div class="grid-2-12" style="padding-left: 10px" >
						<a4j:commandButton reRender="pgMensagens,formCadastroMembro,exibirTitulo"  styleClass="form-button" id="cbSalvarMembro" value="Salvar" action="#{membroCadastro.salvar}"  rendered="#{membroCadastro.membro.coSeqMembro == null}" >	</a4j:commandButton>
					</div >
				 </h:panelGroup >
			 </h:panelGroup>
			 <h:panelGroup id="pgEditarPorPerfil" rendered="#{usuarioLogado.exibirEditar}">
				  <h:panelGroup rendered="#{membroCadastro.exibirBotaoAtualizar}"  >
					<div class="grid-2-12" style="padding-left: 10px" >
						<a4j:commandButton reRender="formCadastroMembro,exibirTitulo"   styleClass="form-button" id="cbAtualizarMembro" value="Atualizar" action="#{membroCadastro.salvar}" >
							 <f:setPropertyActionListener target="#{membroCadastro.file}" value="#{fileUploadBean.file}"/>	
						</a4j:commandButton>
					</div >
				</h:panelGroup>
			</h:panelGroup>
			<h:panelGroup id="pgExcluirPorPerfil" rendered="#{usuarioLogado.exibirExcluir}">
				 <h:panelGroup rendered="#{membroCadastro.exibirBotaoExcluir}">
					<div class="grid-2-12" style="padding-left: 8px" >
						<a4j:commandButton immediate="true"  styleClass="form-button" id="cbExcluirMembro" value="Excluir" onclick="Richfaces.showModalPanel('modalPanelConfirmaExcluir');" >	
							 <f:setPropertyActionListener target="#{membroCadastro.coMembro}" value="#{membroCadastro.membro.coSeqMembro}"/>  
						</a4j:commandButton>
					</div >
				</h:panelGroup>
			</h:panelGroup>
			
		</h:form>
		</div>
		  <t:saveState  value="#{membroCadastro.membro}"/>
		  <t:saveState  value="#{membroCadastro.listaFuncaoPretendida}"/>
		  <t:saveState  value="#{membroCadastro.listaFuncaoExerce}"/>
		  <t:saveState  value="#{membroCadastro.file}"/>
		  <t:saveState  value="#{membroCadastro.exibirCadastro}"/>
		  <t:saveState  value="#{membroCadastro.exibirPesquisa}"/>
	   	  <t:saveState  value="#{membroCadastro.exibirBotaoNovo}"/>
	      <t:saveState  value="#{membroCadastro.exibirBotaoSalvar}"/>
	      <t:saveState  value="#{membroCadastro.exibirBotaoAtualizar}"/>
	      <t:saveState  value="#{membroCadastro.exibirBotaoExcluir}"/>
	      <t:saveState  value="#{membroCadastro.exibirBotaoVoltar}"/>
	      <t:saveState  value="#{membroCadastro.listaMembros}"/>
	      <t:saveState  value="#{membroCadastro.file}"/>
	      <t:saveState  value="#{membroCadastro.visitante}"/>
	       <t:saveState  value="#{membroCadastro.listaIgreja}"/>
		   <t:saveState  value="#{membroCadastro.funcaoPretendida}"/>
		   <t:saveState  value="#{membroCadastro.listaFuncao}"/>
		  
		  <h:panelGroup id="pGPopupValidaNumeroFaixa"  >
				
					<rich:modalPanel  id="alertaAddFoto"    styleClass="form-lbl" style="text-align: center; width: 400;height:600px">
					<f:facet name="header">
			            <h:panelGroup>
			                <h:outputText value="Foto"></h:outputText>
			            </h:panelGroup>
			        </f:facet>
			        <f:facet name="controls">
			            <h:panelGroup>
			              	<a4j:commandLink  onclick="Richfaces.hideModalPanel('alertaAddFoto')" >
			              		<h:graphicImage value="/resources/imagens/close.png" id="giAdd" styleClass="hidelink"/>
			              	</a4j:commandLink>		                
			            </h:panelGroup>
			        </f:facet>
						<h:form id="formPopupAddFoto" >
						<div class="grid-5-12" >
						  <h:panelGrid style="width:300px" >						  
					            <rich:fileUpload styleClass="upload"  fileUploadListener="#{fileUploadBean.listener}"
					                maxFilesQuantity="#{fileUploadBean.uploadsAvailable}"
					                id="upload"
					                
					                immediateUpload="#{fileUploadBean.autoUpload}"
					                acceptedTypes="jpg, gif, png, bmp" allowFlash="#{fileUploadBean.useFlash}">
					                <a4j:support event="onuploadcomplete" reRender="formPopupAddFoto" >
					                	 <f:setPropertyActionListener target="#{membroCadastro.file}" value="#{fileUploadBean.file}"/>	
					                </a4j:support>
					            </rich:fileUpload>
					            <div  class="field-clear"></div>
					            <h:panelGroup id="info">
					                <rich:panel bodyClass="info">
					                    <f:facet name="header">
					                        <h:outputText value="Foto carregada." />
					                    </f:facet>
					                    <h:outputText value="Nenhuma Foto carregada."
					                        rendered="#{fileUploadBean.size==0}" />
					                    <rich:dataGrid columns="1" value="#{fileUploadBean.files}" var="file" rowKeyVar="row">
					                        <rich:panel bodyClass="rich-laguna-panel-no-header">
					                            <h:panelGrid columns="2">
					                                <a4j:mediaOutput styleClass="uploadFoto" element="img" mimeType="#{file.mime}"
					                                    createContent="#{fileUploadBean.paint}" value="#{row}"
					                                     cacheable="false">
					                                    <f:param value="#{fileUploadBean.timeStamp}" name="time"/>  
					                                </a4j:mediaOutput>
					                            </h:panelGrid>
					                        </rich:panel>
					                    </rich:dataGrid>
					                </rich:panel>
					                <rich:spacer height="3"/>
					                <br />
					                <a4j:commandButton action="#{fileUploadBean.clearUploadData}"
					                    reRender="info, upload" value="Remover Foto"
					                    rendered="#{fileUploadBean.size>0}" />
					            </h:panelGroup>
					        </h:panelGrid>
					        </div>
						</h:form>
					</rich:modalPanel>
				
			</h:panelGroup>		
			
			<rich:modalPanel id="modalPanelConfirmaExcluir" width="280"
					autosized="false" resizeable="false" height="110">
			<div class="form">
			<h:form id="fomModal" >
					<center>
						<div style="margin-left: 40px; margin-bottom: 30px" class="grid-9-12" >
							<h:outputText styleClass="infoRegistroNaoEnc" value="#{msg['info.MSG_02']}"  />
						</div>	
						 <div class="field-clear"></div>
						<div style="margin-left: 60px" class="grid-3-12" >
							<a4j:commandButton ajaxSingle="true" value="Confirmar" action="#{membroCadastro.excluir}" 
								id="btnConfirmar" styleClass="form-button"
								reRender="formCadastroMembro,exibirTitulo" oncomplete="Richfaces.hideModalPanel('modalPanelConfirmaExcluir');"  style="width=50px">
								<f:setPropertyActionListener target="#{membroCadastro.coMembro}" value="#{membroCadastro.membro.coSeqMembro}"/>
							</a4j:commandButton>
						</div>	
						<div style="margin-left: 10px" class="grid-3-12" >
							<a4j:commandButton ajaxSingle="true" value="Cancelar" 				id="btnCancelar" styleClass="form-button"
								onclick="Richfaces.hideModalPanel('modalPanelConfirmaExcluir');"  style="width=50px">
							</a4j:commandButton>
						</div>	
					</center>
		</h:form>
		</div>
		</rich:modalPanel>
		  
	</ui:define>
	
</ui:composition>

